<?php 
require_once './../permisos.php';
if(!empty($_GET['file']) && is_file(__DIR__.DS.basename($_GET['file'])))
{
	echo '<a href="'. URI::newQuery($_GET,'file') .'">RETROCEDER ..</a>';
	echo "<pre>";
	echo htmlentities(file_get_contents(__DIR__.DS.basename($_GET['file'])));
	echo "<pre />";
}
else
{
	foreach(new DirectoryIterator(__DIR__) as $child)
	{
		if(!$child->isFile() || strtolower(pathinfo($child->getFilename() , PATHINFO_EXTENSION)) != 'php' ){continue;}
		$url = URI::newQuery(array('file'=>$child->getFilename()))->href();
		echo "<a href='".$url."'> " .$child->getFilename(). "</a>";
		echo '<br />';
	}
}